﻿//*************************************************************************
//面向服务的协作式智能交通系统仿真软件SoC-ITSS v2.1 alpha
//发布单位：西北工业大学--巴黎高科MINES机器人与群智能系统联合实验室
//团队负责人：张凯龙 Zhang Kailong
//团队成员：张大方、杨安胜、王敏、谢策、王雨佳、谢尘玉等
//联系我们：kl.zhang@nwpu.edu.cn
//2012-2021
//*************************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

//*******************************************************
//
//文件名(File Name):           SCSID.cs
//
//数据表(Tables):              nothing 
//
//          修改理由：         创建类
//
//*******************************************************
namespace CyberCarSimulation.Regulation
{
    //SCS静态临界区的定义
    //根据当前的仿真模式、车辆所处车道以及进行方向设定车辆需要占有的SCSID的编号
    class SCS_ID
    {
        public static string[, ,] SCS_IDs = new string[3, 5, 5];           //车辆的临界区
        public static string[, ,] SCS_IDs_Leave = new string[3, 5, 5];     //车辆的临界区

        //初始化参数的值
        public static void setParams()
        {

            //创建多维数组
            for (int i = 0; i < 3; ++i)
            {
                for (int j = 0; j < 5; j++)
                {
                    for (int k = 0; k < 5; k++)
                    {
                        SCS_ID.SCS_IDs[i, j, k] = null;
                    }
                }
            }

            //全十字路口模式下,大车左拐需要四个临界区
            SCS_ID.SCS_IDs[1, Definitions.WtoE_Lane, Definitions.StoN_Lane] = "3421"; //left
            SCS_ID.SCS_IDs[1, Definitions.WtoE_Lane, Definitions.WtoE_Lane] = "34";
            SCS_ID.SCS_IDs[1, Definitions.WtoE_Lane, Definitions.NtoS_Lane] = "3";
            SCS_ID.SCS_IDs[1, Definitions.EtoW_Lane, Definitions.NtoS_Lane] = "2134"; //left
            SCS_ID.SCS_IDs[1, Definitions.EtoW_Lane, Definitions.EtoW_Lane] = "21";
            SCS_ID.SCS_IDs[1, Definitions.EtoW_Lane, Definitions.StoN_Lane] = "2";
            SCS_ID.SCS_IDs[1, Definitions.NtoS_Lane, Definitions.WtoE_Lane] = "1342"; //left
            SCS_ID.SCS_IDs[1, Definitions.NtoS_Lane, Definitions.NtoS_Lane] = "13";
            SCS_ID.SCS_IDs[1, Definitions.NtoS_Lane, Definitions.EtoW_Lane] = "1";
            SCS_ID.SCS_IDs[1, Definitions.StoN_Lane, Definitions.EtoW_Lane] = "4213"; //left
            SCS_ID.SCS_IDs[1, Definitions.StoN_Lane, Definitions.StoN_Lane] = "42";
            SCS_ID.SCS_IDs[1, Definitions.StoN_Lane, Definitions.WtoE_Lane] = "4";

            //全十字路口模式下,大车离开临界区的顺序
            SCS_ID.SCS_IDs_Leave[1, Definitions.WtoE_Lane, Definitions.StoN_Lane] = "3142"; //left
            SCS_ID.SCS_IDs_Leave[1, Definitions.WtoE_Lane, Definitions.WtoE_Lane] = "34";
            SCS_ID.SCS_IDs_Leave[1, Definitions.WtoE_Lane, Definitions.NtoS_Lane] = "3";
            SCS_ID.SCS_IDs_Leave[1, Definitions.EtoW_Lane, Definitions.NtoS_Lane] = "2413"; //left
            SCS_ID.SCS_IDs_Leave[1, Definitions.EtoW_Lane, Definitions.EtoW_Lane] = "21";
            SCS_ID.SCS_IDs_Leave[1, Definitions.EtoW_Lane, Definitions.StoN_Lane] = "2";
            SCS_ID.SCS_IDs_Leave[1, Definitions.NtoS_Lane, Definitions.WtoE_Lane] = "1234"; //left
            SCS_ID.SCS_IDs_Leave[1, Definitions.NtoS_Lane, Definitions.NtoS_Lane] = "13";
            SCS_ID.SCS_IDs_Leave[1, Definitions.NtoS_Lane, Definitions.EtoW_Lane] = "1";
            SCS_ID.SCS_IDs_Leave[1, Definitions.StoN_Lane, Definitions.EtoW_Lane] = "4321"; //left
            SCS_ID.SCS_IDs_Leave[1, Definitions.StoN_Lane, Definitions.StoN_Lane] = "42";
            SCS_ID.SCS_IDs_Leave[1, Definitions.StoN_Lane, Definitions.WtoE_Lane] = "4";

            //全十字路口模式下,小车左拐需要三个临界区
            SCS_ID.SCS_IDs[2, Definitions.WtoE_Lane, Definitions.StoN_Lane] = "342"; //left
            SCS_ID.SCS_IDs[2, Definitions.WtoE_Lane, Definitions.WtoE_Lane] = "34";
            SCS_ID.SCS_IDs[2, Definitions.WtoE_Lane, Definitions.NtoS_Lane] = "3";
            SCS_ID.SCS_IDs[2, Definitions.EtoW_Lane, Definitions.NtoS_Lane] = "213"; //left
            SCS_ID.SCS_IDs[2, Definitions.EtoW_Lane, Definitions.EtoW_Lane] = "21";
            SCS_ID.SCS_IDs[2, Definitions.EtoW_Lane, Definitions.StoN_Lane] = "2";
            SCS_ID.SCS_IDs[2, Definitions.NtoS_Lane, Definitions.WtoE_Lane] = "134"; //left
            SCS_ID.SCS_IDs[2, Definitions.NtoS_Lane, Definitions.NtoS_Lane] = "13";
            SCS_ID.SCS_IDs[2, Definitions.NtoS_Lane, Definitions.EtoW_Lane] = "1";
            SCS_ID.SCS_IDs[2, Definitions.StoN_Lane, Definitions.EtoW_Lane] = "421"; //left
            SCS_ID.SCS_IDs[2, Definitions.StoN_Lane, Definitions.StoN_Lane] = "42";
            SCS_ID.SCS_IDs[2, Definitions.StoN_Lane, Definitions.WtoE_Lane] = "4";

            //全十字路口模式下,小车离开临界区的顺序
            SCS_ID.SCS_IDs_Leave[2, Definitions.WtoE_Lane, Definitions.StoN_Lane] = "342"; //left
            SCS_ID.SCS_IDs_Leave[2, Definitions.WtoE_Lane, Definitions.WtoE_Lane] = "34";
            SCS_ID.SCS_IDs_Leave[2, Definitions.WtoE_Lane, Definitions.NtoS_Lane] = "3";
            SCS_ID.SCS_IDs_Leave[2, Definitions.EtoW_Lane, Definitions.NtoS_Lane] = "213"; //left
            SCS_ID.SCS_IDs_Leave[2, Definitions.EtoW_Lane, Definitions.EtoW_Lane] = "21";
            SCS_ID.SCS_IDs_Leave[2, Definitions.EtoW_Lane, Definitions.StoN_Lane] = "2";
            SCS_ID.SCS_IDs_Leave[2, Definitions.NtoS_Lane, Definitions.WtoE_Lane] = "134"; //left
            SCS_ID.SCS_IDs_Leave[2, Definitions.NtoS_Lane, Definitions.NtoS_Lane] = "13";
            SCS_ID.SCS_IDs_Leave[2, Definitions.NtoS_Lane, Definitions.EtoW_Lane] = "1";
            SCS_ID.SCS_IDs_Leave[2, Definitions.StoN_Lane, Definitions.EtoW_Lane] = "421"; //left
            SCS_ID.SCS_IDs_Leave[2, Definitions.StoN_Lane, Definitions.StoN_Lane] = "42";
            SCS_ID.SCS_IDs_Leave[2, Definitions.StoN_Lane, Definitions.WtoE_Lane] = "4";
        }
    }
}
